package com.guoyw.seata.account.dubbo;

import com.guoyw.seata.account.service.ITAccountService;
import com.guoyw.seata.common.dto.AccountDTO;
import com.guoyw.seata.common.dubbo.AccountDubboService;
import com.guoyw.seata.common.response.ObjectResponse;
import io.seata.core.context.RootContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 账户服务 api impl
 * author: guoyw
 * create: 2020-09-19 16:29
 **/
@Service(version = "1.0.0",protocol = "${dubbo.protocol.id}",
  application = "${dubbo.application.id}",registry = "${dubbo.registry.id}",
  timeout = 3000)
@Slf4j
public class AccountDubboServiceImpl implements AccountDubboService{
  
  @Autowired
  private ITAccountService accountService;
  
  @Override
  public ObjectResponse decreaseAccount(AccountDTO accountDTO){
    log.info("全局事务id ：" + RootContext.getXID());
    return accountService.decreaseAccount(accountDTO);
  }
}
